{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/v5/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"58ae9d0c10a34996b078139b52746028\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts'], function(echarts) {\n",
       "                var chart_58ae9d0c10a34996b078139b52746028 = echarts.init(\n",
       "                    document.getElementById('58ae9d0c10a34996b078139b52746028'), 'white', {renderer: 'canvas'});\n",
       "                var option_58ae9d0c10a34996b078139b52746028 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"effectScatter\",\n",
       "            \"name\": \"\\u5174\\u8da3\\u5206\\u5e03\",\n",
       "            \"showEffectOn\": \"render\",\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            },\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5f71\\u89c6\\u97f3\\u4e50\",\n",
       "                    8\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u6559\\u80b2\\u57f9\\u8bad\",\n",
       "                    68\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u8d44\\u8baf\",\n",
       "                    55\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u533b\\u7597\\u5065\\u5eb7\",\n",
       "                    58\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4e66\\u7c4d\\u9605\\u8bfb\",\n",
       "                    30\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u65c5\\u6e38\\u51fa\\u884c\",\n",
       "                    15\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u4f11\\u95f2\\u7231\\u597d\",\n",
       "                    6\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u6e38\\u620f\",\n",
       "                    29\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u91d1\\u878d\\u8d22\\u7ecf\",\n",
       "                    3\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5174\\u8da3\\u5206\\u5e03\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5f71\\u89c6\\u97f3\\u4e50\",\n",
       "                \"\\u6559\\u80b2\\u57f9\\u8bad\",\n",
       "                \"\\u8d44\\u8baf\",\n",
       "                \"\\u533b\\u7597\\u5065\\u5eb7\",\n",
       "                \"\\u4e66\\u7c4d\\u9605\\u8bfb\",\n",
       "                \"\\u65c5\\u6e38\\u51fa\\u884c\",\n",
       "                \"\\u4f11\\u95f2\\u7231\\u597d\",\n",
       "                \"\\u6e38\\u620f\",\n",
       "                \"\\u91d1\\u878d\\u8d22\\u7ecf\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"axisTick\": {\n",
       "                \"show\": true,\n",
       "                \"alignWithLabel\": false,\n",
       "                \"inside\": false\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8,\n",
       "                \"formatter\": \"{value} %\"\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"\\u6821\\u56ed\\u9738\\u51cc\\u5173\\u6ce8\\u8005\\u5174\\u8da3\\u5206\\u5e03\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_58ae9d0c10a34996b078139b52746028.setOption(option_58ae9d0c10a34996b078139b52746028);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1a91ea0aa60>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts  \n",
    "from pyecharts.charts import EffectScatter  \n",
    " \n",
    "y_data = [8,68,55,58,30,15,6,29,3,12]  # 百分比数据\n",
    "  \n",
    "# 创建一个 EffectScatter 对象  \n",
    "c = (  \n",
    "    EffectScatter()  \n",
    "    .add_xaxis([\"影视音乐\", \"教育培训\", \"资讯\", \"医疗健康\", \"书籍阅读\", \"旅游出行\",\"休闲爱好\",\"游戏\",\"金融财经\"])  # X轴数据  \n",
    "    .add_yaxis(\"兴趣分布\", y_data)  # Y轴数据  \n",
    "    .set_global_opts(  \n",
    "        title_opts=opts.TitleOpts(title=\"校园霸凌关注者兴趣分布\"),  \n",
    "        yaxis_opts=opts.AxisOpts(  \n",
    "            axistick_opts=opts.AxisTickOpts(is_show=True),  \n",
    "            splitline_opts=opts.SplitLineOpts(is_show=True),  \n",
    "            axislabel_opts=opts.LabelOpts(formatter=\"{value} %\")  # 设置标签格式为百分比  \n",
    "        ),  \n",
    "    )  \n",
    ")  \n",
    "c.render_notebook()  \n",
    "# c.render(\"effectscatter_percentage_y_axis.html\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
